libxl: Fix error handling in libxl__device_nic_from_xs_be
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 26 Nov 2013 12:08:09 +0000 (12:08 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 18 Dec 2013 11:09:58 +0000 (11:09 +0000)
commit274ef72d25262f6157b49a335ef70111dc45608d
tree33057cb0994c5332d29e063ca529a422f3bdfba1
parent492b0688f58c7c0150712f09677a6c140fdccd96
libxl: Fix error handling in libxl__device_nic_from_xs_be

Previously, this function would leak the temporary return from xs_read for
handle and mac address.  Fix both of these and the rest of the error handling.

This requires changing its return type and fixing the callers.

Introduce here a READ_BACKEND macro to make the code less repetitive.

Coverity ID: 1055886

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- spell out what the leaks were in the commit message ]
tools/libxl/libxl.c